package cn.bdqn.service;

import cn.bdqn.domain.*;
import cn.bdqn.service.impl.OrderServiceImpl;
import cn.bdqn.utils.result.Page;
import cn.bdqn.utils.result.Result;
import cn.bdqn.utils.result.ResultGenerator;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *
 * @author dkj
 */
@Service
@FeignClient(name = "lms-order",fallback = OrderServiceImpl.class)
public interface OrderService {


    /**
     * 根据id查询
     * @param id
     * @return
     */
    @GetMapping("/order/query/{id}")
    public Result queryByPrimaryKey(@PathVariable("id") Integer id);


    /**
     * 查询全部 分页
     * @param currentPage  当前页
     * @param pageSize 每页显示数量
     * @param orderNumber 订单号
     * @param paymentType 付款类型
     * @param state 订单状态  1.处理  2.未处理
     * @return
     */
    @GetMapping("/order/query/{currentPage}/{pageSize}/{orderNumber}/{paymentType}/{state}")
    public Result queryByOrderNumberAndPaymentType(@PathVariable("currentPage") Integer currentPage,
                                                   @PathVariable("pageSize") Integer pageSize,
                                                   @PathVariable("orderNumber") String orderNumber,
                                                   @PathVariable("paymentType") Integer paymentType,
                                                   @PathVariable("state") Integer state);



    /**
     * 新增订单
     * @param order
     * @return
     */
    @PostMapping("/order/save/")
    public Result saveOrder(Order order);



    /**
     * 修改
     * @param order
     * @return
     */
    @PutMapping("/order/update/")
    public Result updateOrder(Order order);


    /**
     * 根据id删除
     * @param id
     * @return
     */
    @DeleteMapping("/order/delete/{id}")
    public Result deleteOrder(@PathVariable("id") Integer id);



    //******************************订单货物
    /**
     * 修改订单货物对象
     * @param orderForm
     * @return
     */
    @PutMapping("/orderFrom/update/")
    public Result updateOrderFrom(OrderForm orderForm);


    /**
     * 新增订单货物id
     * @param orderForms
     * @return
     */
    @PostMapping("/orderFrom/save/")
    public Result save(@RequestBody List<OrderForm> orderForms);


    //************************派单表************************

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @GetMapping("/delivery/query/{id}")
    public Result queryByIdDelivery(@PathVariable("id") Integer id);


    /**
     * 新增
     * @param delivery
     * @return
     */
    @PostMapping("/delivery/save/")
    public Result saveDelivery(Delivery delivery);


    /**
     * 根据订单号模糊查询
     * @param currentPage
     * @param pageSize
     * @param sendFreightNumber
     * @return
     */
    @GetMapping("/delivery/querySendFreightNumber/{currentPage}/{pageSize}/{sendFreightNumber}")
    public Result queryBySendFreightId(@PathVariable("currentPage") Integer currentPage,
                                       @PathVariable("pageSize") Integer pageSize,
                                       @PathVariable("sendFreightNumber") String sendFreightNumber);


    /**
     * 修改
     * @param delivery
     * @return
     */
    @PutMapping("/delivery/update/")
    public Result updateDelivery(Delivery delivery);



    //******************回执单*********************
    /**
     * 根据id查询
     * @param id
     * @return
     */
    @GetMapping("/receipt/query/{id}")
    public Result queryByIdReceipt(@PathVariable("id") Integer id);


    /**
     * 根据发货单号模糊查询
     * @param currentPage
     * @param pageSize
     * @param sendFreightNumber
     * @param state
     * @return
     */
    @GetMapping("/receipt/query/{currentPage}/{pageSize}/{sendFreightNumber}/{state}")
    public Result queryBySendFreightId(@PathVariable("currentPage") Integer currentPage,
                                       @PathVariable("pageSize") Integer pageSize,
                                       @PathVariable("sendFreightNumber") String sendFreightNumber,
                                       @PathVariable("state") Integer state);



    /**
     * 新增
     * @param receipt
     * @return
     */
    @PostMapping("/receipt/save/")
    public Result saveReceipt(Receipt receipt);


    /**
     * 修改当前对象
     * @param receipt
     * @return
     */
    @PutMapping("/receipt/update/")
    public Result updateReceipt(Receipt receipt);


    //***************补货单****************
    /**
     * 根据id查询
     * @param id
     * @return
     */
    @GetMapping("/replenish/query/{id}")
    public Result queryByIdReplenish(@PathVariable("id") Integer id);

    /**
     * 根据发货单号和订单状态查询
     * @param currentPage 当前页
     * @param pageSize 显示数量
     * @param sendFreightNumber  发货单号
     * @param transportState 补货单状态
     * @return
     */
    @GetMapping("/replenish/query/{currentPage}/{pageSize}/{sendFreightNumber}/{transportState}")
    public Result selectBySendNumberAndTransportState(@PathVariable("currentPage") Integer currentPage,
                                                      @PathVariable("pageSize") Integer pageSize,
                                                      @PathVariable("sendFreightNumber") String sendFreightNumber,
                                                      @PathVariable("transportState") Integer transportState);
    /**
     * 新增
     * @param replenish
     * @return
     */
    @PostMapping("/replenish/save/")
    public Result saveReplenish(Replenish replenish);


    /**
     * 修改
     * @param replenish
     * @return
     */
    @PutMapping("/replenish/update/")
    public Result updateReplenish(Replenish replenish);

    //*******************补货配货单*************

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @GetMapping("/replenishEquip/query/{id}")
    public Result queryByIdReplenishEquip(@PathVariable("id") Integer id);
    /**
     * 根据补货单号查询
     * @param replenishId
     * @return
     */
    @GetMapping("/replenishEquip/queryByReplenishId/{replenishId}")
    public Result queryByReplenishId(@PathVariable("replenishId") Integer replenishId);


    /**
     * 新增
     * @param replenishEquips
     * @return
     */
    @PostMapping("/replenishEquip/save/")
    public Result saveReplenishEquip(List<ReplenishEquip> replenishEquips);

    /**
     * 修改
     * @param replenishEquip
     * @return
     */
    @PutMapping("/replenishEquip/update/")
    public Result updateReplenishEquip(ReplenishEquip replenishEquip);


    //********************发货单*******************
    /**
     * 根据id查询
     * @param id
     * @return
     */
    @GetMapping("/sendFreight/query/{id}")
    public Result queryByIdSendFreight(@PathVariable("id") Integer id);

    /**
     * 根据发货单号模糊查询
     * @param sendFreightNumber
     * @return
     */
    @GetMapping("/sendFreight/querys/{sendFreightNumber}")
    public Result queryByLikeSendFreightNumber(@PathVariable("sendFreightNumber") String sendFreightNumber);
    /**
     * 根据发货订单和支付类型和发货单状态查询
     * @param currentPage
     * @param pageSize
     * @param sendFreightNumber
     * @param paymentType
     * @param sendFreightState
     * @return
     */
    @GetMapping("/sendFreight/query/{currentPage}/{pageSize}/{sendFreightNumber}/{paymentType}/{sendFreightState}")
    public Result queryLikeSendFreightNumberByPaymentTypeBySendFreightState(
            @PathVariable("currentPage") Integer currentPage,
            @PathVariable("pageSize") Integer pageSize,
            @PathVariable("sendFreightNumber") String sendFreightNumber,
            @PathVariable("paymentType") Integer paymentType,
            @PathVariable("sendFreightState") Integer sendFreightState);

    /**
     * 新增
     * @param sendFreight
     * @return
     */
    @PostMapping("/sendFreight/save/")
    public Result saveSendFreight(SendFreight sendFreight);
    /**
     * 更新
     * @param sendFreight
     * @return
     */
    @PutMapping("/sendFreight/update/")
    public Result updateSendFreight(SendFreight sendFreight);

    //******************发货单配货层*****************
    /**
     * 根据id查询
     * @param id
     * @return
     */
    @GetMapping("/sendEquip/query/{id}")
    public Result queryByIdSendEquip(@PathVariable("id") Integer id);


    /**
     * 根据发货单id查询
     * @param sendFreightId
     * @return
     */
    @GetMapping("/sendEquip/querys/{sendFreightId}")
    public Result queryBySendFreightId(@PathVariable("sendFreightId") Integer sendFreightId);


    /**
     * 新增
     * @param sendEquips
     * @return
     */
    @PostMapping("/sendEquip/save/")
    public Result saveSendEquip(List<SendEquip> sendEquips);

    /**
     * 更新
     * @param sendEquip
     * @return
     */
    @PutMapping("/sendEquip/update/")
    public Result updateSendEquip(SendEquip sendEquip);

}
